﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Forget.HRBLL.Logical;

namespace HRWebSite.User
{
    public partial class EditInfo : BasePage
    {        
        protected override void Page_Load(object sender, EventArgs e)
        {            
            this.HRLimitAttribute = Forget.HRBLL.LimitAttribute.Read | Forget.HRBLL.LimitAttribute.Modify;
            this.HRLimits = Limits.UserInfo;
            this.Page.Title = "修改个人信息";
            base.Page_Load(sender, e);
            
            if (!this.Page.IsPostBack)
            {
                this.TextBox1.Text = this.HRUser.UserName;
                this.TextBox4.Text = this.HRUser.Name;
                this.TextBox2.Text = this.HRUser.Email;
                this.TextBox3.Text = this.HRUser.Phone;
            }
        }      

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (!UserLogical.ModifyUserBaseInfo(this.HRUser.NumberID, this.TextBox2.Text, this.TextBox3.Text, this.TextBox4.Text))
                this.literal1.Text = "<span style=\"color: #FF0000\">系统出现故障，请等待或与管理员联系！</span>";
            else
            {
                Session["CurUser"] = UserLogical.GetUserInfo_NumberID(HRUser.NumberID);
                this.literal1.Text = "<span style=\"color: #FF0000\">信息修改成功</span>";
            }
        }
    }
}